#pragma once

#include "MyMap_global.h"
#include "HttpLoader.h"
#include <QObject>
#include<QVector>
#include <QMap>
#include <iostream>
#include <memory>

using namespace std;

class MyScene;
class MyView;
class MyTileGraphicsItem;
class TileKey;
class MyTileSources:public QObject
{
	Q_OBJECT
public:
	MyTileSources(MyScene * pscene, MyView* pview);
	~MyTileSources();
    
	void RequstData(int x, int y, int z, MyTileGraphicsItem* item,MapDataType& maptype);
	void Clear();
	void UpateSource();
private:
	void  GetTileFileName(int x, int y, int z,QString& pathfile,QString& filename, MapDataType& maptype);

	QString GetDownLoadURL(int x, int y, int z, MapDataType& maptype);
public slots:
	void slot_returResult(HttpLoader *loader, QString& path);
	
private:
	HttpLoader * m_pHttpLoader;
	QMap<QString, shared_ptr<HttpLoader>> map;
	QMap<QString, MyTileGraphicsItem*> itemmap;
	MyScene * m_pScne;
	MyView * m_pView;

};

